home *** CD-ROM | disk | FTP | other *** search
- /*
- ** STATUS.C [edit EMAIL.H before compiling]
- **
- ** This program displays the header from each
- ** email message on the SMTP server.
- */
-
- #include <windows.h>
- #include <stdio.h>
- #include "see.h"
- #include "email.h"
-
- #define BUFF_SIZE 2048
- #define TEMP_SIZE 128
-
- static char Buffer[BUFF_SIZE];
- static char Temp[TEMP_SIZE];
-
- void ErrorExit(int Code)
- {seeErrorText(Code,(LPSTR)Buffer,512);
- printf("SEE Error %d: %s\n", Code, Buffer);
- seeClose();
- exit(1);
- }
-
- void main(void)
- {int i, n;
- int Code;
- int NbrMsg;
- int Version;
- long MsgSize;
-
- Version = seeStatistics(SEE_GET_VERSION);
- printf("SEE4C Version %1x.%1x.%1x\n",0x0f&(Version>>8),0x0f&(Version>>4),0x0f&Version);
-
- /* define diagnostics log file */
- seeStringParam(SEE_LOG_FILE, (LPSTR)"status.log");
- /* connect to POP3 server */
- printf("Connecting to %s ...",(LPSTR)POP3_HOST_NAME);
- Code = seePop3Connect(
- (LPSTR)POP3_HOST_NAME, /* POP3 server */
- (LPSTR)POP3_USER_NAME, /* user */
- (LPSTR)POP3_PASSWORD); /* Password */
- if(Code>=0) printf("OK\n");
- else ErrorExit(Code);
- /* get # messages waiting */
- puts("Getting message count...");
- NbrMsg = seeGetEmailCount();
- if(NbrMsg<0) ErrorExit(NbrMsg);
- printf("%d messages waiting.\n", NbrMsg);
- /* read message headers */
- for(i=1;i<=NbrMsg;i++)
- {/* read message i */
- printf("---[ Message %d, ",i);
- Code = seeGetEmailLines(i, 0, (LPSTR)Buffer, BUFF_SIZE);
- if(Code<0) ErrorExit(Code);
- MsgSize = seeGetEmailSize(i);
- printf("%d bytes ]-------------------------------\n",MsgSize);
- ///Buffer[Code] = '\0';
- /* display "DATE: " line */
- n = seeExtractText((LPSTR)Buffer, "Date: ", (LPSTR)Temp, TEMP_SIZE);
- if(n>0) printf("%s", (LPSTR)Temp);
- /* display "FROM: " line */
- n = seeExtractText((LPSTR)Buffer, "From: ", (LPSTR)Temp, TEMP_SIZE);
- if(n>0) printf("%s", (LPSTR)Temp);
- /* display "SUBJECT: " line */
- n = seeExtractText((LPSTR)Buffer, "Subject: ", (LPSTR)Temp, TEMP_SIZE);
- if(n>0) printf("%s", (LPSTR)Temp);
- }
- printf("----------------------------------------------------\n");
- seeClose();
- } /* end main */
-
-
-